package com.elastic.sort.type;

/**
 * @ClassName DefaultEnumType
 * @Author xiezhuocai
 * @Description 默认的es查询排序策略
 * @Date 2021/12/22 11:38
 */
public enum DefaultEnumType implements BaseEnumType {

    /***
     * 默认排序
     **/
    DEFAULT("0", "按综合评分排序");

    private String code;

    private String msg;

    DefaultEnumType(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    @Override
    public String getCode() {
        return code;
    }

    @Override
    public String getMsg() {
        return msg;
    }

    private void setCode(String code) {
        this.code = code;
    }

    private void setMsg(String msg) {
        this.msg = msg;
    }

    public static BaseEnumType getByCode(String code) {
        for (DefaultEnumType defaultEnumType : DefaultEnumType.values()) {
            if (defaultEnumType.getCode().equals(code)) {
                return defaultEnumType;
            }
        }
        return null;
    }
}
